package com.xiaoxi.statemode.state;

import com.xiaoxi.statemode.context.Context;

/**
 * @Author xiaoxi
 * @ProjectName design_mode
 * @PackageName com.xiaoxi.statemode.state
 * @ClassName NightState
 * @Description TODO
 * @Date 2023/3/27 21:31
 * @Version 1.0
 */
public class NightState implements State {

    private String name;
    private static NightState nightState = new NightState("晚上");

    private NightState(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public static NightState getInstance() {
        return nightState;
    }

    @Override
    public void doClock(Context context, int hour) {
        if (hour >= 9 && hour < 17) {
            context.changeState(DayState.getInstance());
        }
    }

    @Override
    public void doUse(Context context) {
        context.callSecurityCenter("紧急！晚上使用金库");
    }

    @Override
    public void doAlarm(Context context) {
        context.callSecurityCenter("紧急！按下警铃（晚上）");
    }

    @Override
    public void doPhone(Context context) {
        context.recordLog("留言一条呼叫（晚上）");
    }
}
